/**
 * Tab选项卡
 * @author Thousand-paper-crane
 * @param {Object} el
 * @param {Number} index
 * @returns undefined
 */
;(function(){
    function Lbt(el){
        this.el=document.querySelector(el)
        this.liObjs=this.el.querySelectorAll('ul li')
        this.imgObjs=this.el.querySelectorAll('div img')
        this.init()
    }
    Lbt.prototype.init=function(){
        this.liOver()
    }
    Lbt.prototype.liOver=function(){
        this.liObjs.forEach((item,index)=>{
            item.onmouseover=()=>{
                this.liChange(index)
                this.imgChange(index)
            }
        })
    }
    Lbt.prototype.liChange=function(index){
        this.liObjs.forEach(item=>{
            item.className=''
        })
        this.liObjs[index].className='action'
    }
    Lbt.prototype.imgChange=function(index){
        this.imgObjs.forEach(item=>{
            item.className=''
        })
        this.imgObjs[index].className='action'
    }
    let lbt1=new Lbt('#box1')
    let lbt2=new Lbt('#box2')
    window.Lbt=Lbt
})()